/**
 * 单例模式
 */

package com.study.s05.singleton;

import com.study.s05.singleton.model.Person2;

public class MainClass {
	
	public static void main(String[] args) {
		
//		Person p1 = new Person();
//		Person p2 = new Person();
		
		//测试饿汉式
//		Person p1 = Person.getPerson();
//		Person p2 = Person.getPerson();
		
		//测试懒汉式
		Person2 p1 = Person2.getPerson();
		Person2 p2 = Person2.getPerson();
		
		p1.setName("zhang");
		p2.setName("li");
		
		System.out.println(p1.getName());
		System.out.println(p2.getName());
	}
}
